package content;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;

import com.opensymphony.xwork2.ActionSupport;

public class LinkXml extends ActionSupport {

	public String filename;

	public String execute() throws Exception {

		try {

			File f = new File("c:/PageXmlDefault.xml");
			FileInputStream fin = new FileInputStream(f);
			SAXBuilder bud = new SAXBuilder();
			Document doc = bud.build(fin);

			Element root = doc.getRootElement();

			Element el0 = null;

			List<Element> li0 = root.getChildren();
			for (int i = 0; i < li0.size(); i++) {
				el0 = (Element) li0.get(i);

				filename = el0.getAttributeValue("pagename");

			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return SUCCESS;
	}

}
